﻿namespace MetaVideoEditorEvolved.Converter
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Data;
    using mveEngine;

    public class CrewStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var crew = value as List<CrewMember>;

            if (crew != null && crew.Count > 0)
            {
                var crewString = new StringBuilder();

                foreach (var member in crew)
                {
                    crewString.Append(member.Name + " - ");
                }

                crewString = crewString.Remove(crewString.Length - 4, 3);

                return crewString.ToString();
            }
            else
            {
                return string.Empty;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
